import { onScopeDispose } from 'vue'
import bus from '@/libs/bus'

const closeEventName = 'close-si-click-event'

// 发送关闭事件
export const emitCloseEvent = data => {
    bus.emit(closeEventName, data)
}

// 接收关闭事件
export const onCloseEvent = callback => {
    bus.on(closeEventName, callback)
    
    onScopeDispose(() => {
        bus.off(closeEventName, callback)
    })
}
